package com.zhx.basis;

import java.util.Calendar;
import java.util.Scanner;
import java.util.concurrent.CountDownLatch;

public class App {
    private static int a=10;
    private String b="sss";

    public static void main(String[] args) {

//        Scanner scanner=new Scanner(System.in);
//        String s = scanner.nextLine();
//        System.out.println(s);

        final CountDownLatch latch = new CountDownLatch(1);

        new Thread(() -> {
            System.out.println("Thread started. Waiting for countdown...");
            try {
                latch.await();  // 这个线程会在这里等待
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("Thread continues after countdown.");
        }).start();

        System.out.println("Main thread doing some work...");
        // 假设这里有一些工作要做

        latch.countDown();  // 这会使上面的线程继续执行
        System.out.println("Main thread finished work. CountDownLatch counted down.");
    }
}
